﻿using System;
using FU.Capstones.IMS.Web.Common;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.EventArgs;

namespace FU.Capstones.IMS.Web.Silverlight.Models
{
    public class MaterialImportModel : ModelBase
    {
        public MaterialImportModel()
        {
            client.GetWarehouseCollectionCompleted += DoGetWarehouseCollectionCompleted;
            client.GetContactCollectionCompleted += DoGetContactCollectionCompleted;
            client.GetMaterialCollectionTypeCompleted += DoGetMaterialCollectionCompleted;
        }
        #region GetCollectionWarehouse

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Warehouse>> GetWarehouseCollectionCompleted;
        void DoGetWarehouseCollectionCompleted(object sender, CollectionFeedbackCompletedEventArgs<Warehouse> e)
        {
            if (GetWarehouseCollectionCompleted != null)
            {
                GetWarehouseCollectionCompleted(sender, e);
            }
        }
        public int GetWarehouseCollectionAsync(bool isShowAll)
        {
            client.GetWarehouseCollectionAsync(isShowAll);
            return WebConstants.MagicNumer;
        }

        #endregion
        #region GetContactCollection

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Contact>> GetContactCollectionCompleted;
        void DoGetContactCollectionCompleted(object sender, CollectionFeedbackCompletedEventArgs<Contact> e)
        {
            if (GetContactCollectionCompleted != null)
            {
                GetContactCollectionCompleted(sender, e);
            }
        }
        public int GetContactCollectionAsync(bool isShowAll)
        {
            client.GetContactCollectionAsync(isShowAll);
            return WebConstants.MagicNumer;
        }

        #endregion
        #region GetMaterialCollectionCompleted

        public event EventHandler<CollectionFeedbackCompletedEventArgs<Material>> GetMaterialCollectionCompleted;
        void DoGetMaterialCollectionCompleted(object sender, CollectionFeedbackCompletedEventArgs<Material> e)
        {
            if (GetMaterialCollectionCompleted != null)
            {
                GetMaterialCollectionCompleted(sender, e);
            }
        }

        public int GetMaterialCollectionAsync(bool isShowAll)
        {
            client.GetMaterialCollectionTypeAsync(isShowAll);
            return WebConstants.MagicNumer;
        }

        #endregion
    }
}
